package com.code.day07.Streamsdy;

import java.util.ArrayList;
import java.util.stream.Stream;

public class DemoStream1 {
    public static void main(String[] args) {
        //针对数组的Stream对象中的静态方法static <T> Stream<T> of(T... values)
        Stream<String> stream = Stream.of("a", "b", "c");
        stream.forEach(System.out::println);


        //针对集合方法：Collection接口中的方法 -> 单列集合的顶级接口
        //default Stream<E> stream()
        ArrayList<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        Stream<String> stream1 = list.stream();
        stream1.forEach(System.out::println);
    }
}
